﻿<template>
  <baseConfigUI :config.sync="config" :events.sync="events">
    <el-row :gutter="20">
      <el-col :span="24">
        <el-form-item label = "占位内容">
            <el-input v-model = "config.other.placeholder"></el-input>
          </el-form-item>
      </el-col>
    </el-row>
    <el-row :gutter="20">
      <el-col :span="24">
        <el-form-item label = "最大长度">
          <el-tooltip effect="dark" content="输入-1表示无限制" placement="top-start">
            <el-input-number size="small" controls-position="right" v-model="config.other.maxLength"></el-input-number>
          </el-tooltip>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row :gutter="20">
      <el-col :span="24">
        <el-form-item label = "多项设置">
          <el-checkbox v-model = "config.other.clearable">显示清除按钮</el-checkbox>
          <el-checkbox v-model = "config.other.isReadOnly">只读</el-checkbox>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row :gutter="20">
      <el-col :span="24">
        <el-form-item label = "类型">
          <el-select v-model="config.other.type" placeholder="请选择">
            <el-option label="单行文本" value="text"></el-option>
            <el-option label="多行文本" value="textarea"></el-option>
          </el-select>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row :gutter="20">
      <el-col :span="24">
        <el-form-item label = "正则校验">
          <!-- <el-input v-model="config.other.regExpress" placeholder="请输入正则表达式"></el-input> -->
          <el-select
            v-model="config.other.regExpress"
            filterable
            allow-create
            placeholder="请选择或输入正则表达式">
            <el-option
              v-for="item in regOptions"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label = "校验失败的提示信息">
          <el-input v-model="config.other.regCheckErr" placeholder="请输入"></el-input>
        </el-form-item>
      </el-col>
    </el-row>
  </baseConfigUI>
</template>
<script>
import baseConfigUI from '../baseConfigUI.vue'
export default {
  components: {baseConfigUI},
  props: ['config', 'events'],
  data () {
    return {
      regOptions: [{
        label: '无',
        value: ''
      }, {
        label: 'Email',
        value: '^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$'
      }, {
        label: '手机号',
        value: '^[1][3,4,5,7,8][0-9]{9}$'
      }, {
        label: 'MAC地址',
        value: '[A-Fa-f0-9]{2}:[A-Fa-f0-9]{2}:[A-Fa-f0-9]{2}:[A-Fa-f0-9]{2}:[A-Fa-f0-9]{2}:[A-Fa-f0-9]{2}'
      }, {
        label: '身份证号',
        value: '^[1-9]\\d{5}(18|19|([23]\\d))\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$'
      }]
    }
  }
}
</script>
